package com.beiding.test.pg;

import com.beiding.sqlbuilder.Table;
import com.beiding.sqlbuilder.TableHandler;
import com.beiding.v2.test.pg.ContentUtils;

import java.util.List;

public class PgTableHandler implements TableHandler {

    //TODO 表中可能带有 join 等信息
    @Override
    public String handle(List<Table> tables) {

        return ContentUtils.join(tables, table -> {
            if (table.getAlias() == null) {
                return table.getName();
            } else {
                return table.getName() + " " + table.getAlias();
            }

        }, ",");
    }

}
